#include <stdio.h>


main () {
	int array [] = { 1,2,3,1,4,1,3 };
	int i ,k , j;
	int len = sizeof (array)/sizeof (int);
 	for (i=0;i < len ;i ++) {
		for (j=1; j < len; j++) {
			if (array[i] == array [j]) {
				printf ("%d ", array [i]);
				array[j] = array[j+1]; len--;j++;
				for (k= j; k < len; k++) {
					if (array[k+1] != array[j])	{
						array[k] = array[k+1]; len--;
					}
				}			
			}
		}
	}
} 
